import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;

@WebServlet("/member")
public class servletMember extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        StringBuilder s = new StringBuilder();
        s.append(req.getProtocol());
        s.append("<br>");
        s.append(req.getMethod());
        s.append("<br>");
        s.append(req.getRequestURI());
        s.append("<br>");
        s.append(req.getContextPath());
        s.append("<br>");
        s.append(req.getQueryString());
        s.append("<br>");
        Enumeration<String> header = req.getHeaderNames();
        while (header.hasMoreElements()){
            String key = header.nextElement();
            String value = req.getHeader(key);
            s.append(key+": "+value+"<br>");
        }
        resp.setContentType("text/html; charset=utf8");
        resp.getWriter().write(s.toString());
    }
}
